/*
** basics.c for mysh in /home/nadali_t//local/svn/tek2ed/minishell1
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Thu Nov  8 12:24:13 2012 thomas nadalie
** Last update Thu Nov  8 12:24:36 2012 thomas nadalie
*/

#include	<unistd.h>
#include	"my.h"

void		my_putchar(char c)
{
  write(1, &c, 1);
}

void		my_putstr(char *str)
{
  int		i;

  i = 0;
  while (str[i])
    my_putchar(str[i++]);
}

int		my_strlen(char *str)
{
  int		i;

  i = 0;
  while (str[i])
    i++;
  return (i);
}

void		my_put_nbr(int nb)
{
  if (nb < 0)
    {
      my_putchar('-');
      nb = nb * -1;
    }
  if (nb > 9)
    my_put_nbr(nb/10);
  my_putchar((nb % 10) + 48);
}

char            *my_strcpy(char *dest, char *src)
{
  int           i;

  i = 0;
  while (src[i])
    {
      dest[i] = src[i];
      i = i + 1;
    }
  dest[i] = '\0';
  return (dest);
}
